#include<bits/stdc++.h>
using namespace std;

string in,pre;
string f(string in,string pre){
	if(in.empty()){
		return "";
	}
	char c=pre[0];
	string leftin="",rightin="";
	int i=0;
	while(in[i]!=c){
		leftin+=in[i];
		i++;
	}
	i++;
	while(in[i]!='\0'){
		rightin+=in[i];
		i++;
	}
	//
	string leftpre="",rightpre="";
	i=1;
	int len=leftin.length();
	while(i<=len){
		leftpre+=pre[i];
		i++;
	};
	while(pre[i]!='\0'){
		rightpre+=pre[i];
		i++;
	}
	return f(leftin,leftpre)+f(rightin,rightpre)+c;
}
int main(){
	cin>>in>>pre;
	cout<<f(in,pre);
	return 0;
}
